<!DOCTYPE html>
<html>
<head>
	<title></title>
	<!--[if lt IE 9]>
	<meta http-equiv="refresh" content="0;ie.html" />
	<![endif]-->

	<link rel="shortcut icon" href="__STATIC__/layout/favicon.ico"> <link href="__STATIC__/layout/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
	<link href="__STATIC__/layout/css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
	<link href="__STATIC__/layout/css/animate.css" rel="stylesheet">
	<link href="__STATIC__/layout/css/style.css?v=4.1.0" rel="stylesheet">
	<link href="__STATIC__/layout/css/channel.css?v=4.1.0" rel="stylesheet">
	<link href="__STATIC__/layout/css/plugins/jsTree/style.min.css" rel="stylesheet">
	<script src="__STATIC__/layout/js/jquery.min.js"></script>
	<!-- Sweet Alert -->
	<link href="__STATIC__/layout/css/plugins/sweetalert/sweetalert.css" rel="stylesheet">
	<!-- Sweet alert -->
	<script src="__STATIC__/layout/js/plugins/sweetalert/sweetalert.min.js"></script>
	<!-- layer javascript -->
	<script src="__STATIC__/layout/js/plugins/layer/layer.min.js"></script>

	<!-- jsTree plugin javascript -->
	<script src="__STATIC__/layout/js/plugins/jsTree/jstree.min.js"></script>
</head>
<body class="white-bg" style="color:#333;padding:3px;">
<div class="ibox" >
	<div class="ibox-content">
		<div id="jstree1">
			<ul>
				{volist name="data" id="row"}
				<li class="jstree-open" data-id="{$row.id}">{$row.title}
					{if isset($row.child)}
					<ul>
						{volist name="row.child" id="row2"}
						<li data-jstree='{"type":"html"}' data-id="{$row2.id}">{$row2.title}</li>
						{/volist}
					</ul>
					{/if}
				</li>
				{/volist}
			</ul>
		</div>
		<div class="row">
			<div class="col-xs-12" style="text-align: center;padding: 20px 0">
				<input class="btn btn-sm btn-primary" type="button" id="tijiao" value="确 定">
			</div>
		</div>

	</div>
</div>


</body>
</html>
<script>
$(function () {
    $('#jstree1').jstree({
        'core': {
            'check_callback': true,
			'multiple':false
        },
        'plugins': ['types', 'dnd'],
        'types': {
            'default': {
                'icon': 'fa fa-folder'
            },
            'html': {
                'icon': 'fa fa-file-code-o'
            },
            'svg': {
                'icon': 'fa fa-file-picture-o'
            },
            'css': {
                'icon': 'fa fa-file-code-o'
            },
            'img': {
                'icon': 'fa fa-file-image-o'
            },
            'js': {
                'icon': 'fa fa-file-text-o'
            }

        }
    });
    var index = parent.layer.getFrameIndex(window.name);
    $('#tijiao').on('click',function () {
        var id = $('.jstree-leaf .jstree-clicked').closest('li').data('id')
        if($('.jstree-leaf .jstree-clicked').is('a')){
            var title = $('.jstree-clicked').text()
            var testNoBtn = parent.layer.getChildFrame('#testNoBtn','{$_GET['frameindex']}')
            testNoBtn.val(title)
            testNoBtn.attr('data-id',id)
            testNoBtn.focus()
		}

        parent.layer.close(index);
    })

})
</script>